#ifndef _IERRORHANDLINGSYSTEM_H_
#define _IERRORHANDLINGSYSTEM_H_

#include "Common.h"
#include "ILog.h"

#define STATUS_SUCCESFUL	0
#define STATUS_FAILED		1

#define SUBSYSTEM_NUM			4
#define SUBSYSTEM_ID_DEFAULT	0
#define SUBSYSTEM_ID_GRAPHICS	1
#define SUBSYSTEM_ID_SOUND		2
#define SUBSYSTEM_ID_INPUT		3

#define USE_DEFAULT_COLOR	0xFFFFFFFF

#ifdef _UNICODE
	#define COLOR_SECTION			L"DEFAULT_COLORS"
	#define CRIT_ERRORCOLOR_KEY		L"CriticalError"
	#define ERROR_COLOR_KEY			L"Error"
	#define WARNING_COLOR_KEY		L"Warning"
	#define DEFAULT_COLOR_NAME		L"Default"

	#define LOGFILENAMES_SECTION	L"LOG_FILES"
	#define GRAPHICS_KEY			L"Graphics"
	#define SOUND_KEY				L"Sound"
	#define INPUT_KEY				L"Input"
	#define DEFAULT_KEY				L"Default"
#else
	#define COLOR_SECTION			"DEFAULT_COLORS"
	#define CRIT_ERRORCOLOR_KEY		"CriticalError"
	#define ERROR_COLOR_KEY			"Error"
	#define WARNING_COLOR_KEY		"Warning"
	#define DEFAULT_COLOR_NAME		"Default"

	#define LOGFILENAMES_SECTION	"LOG_FILES"
	#define GRAPHICS_KEY			"Graphics"
	#define SOUND_KEY				"Sound"
	#define INPUT_KEY				"Input"
	#define DEFAULT_KEY				"Default"
#endif

class IErrorHandlingSys
{
public:
	static lvVoid CriticalError(const lvString &cstrDescription, const lvInt ciSubSys_ID);
	static lvVoid Error(const lvString &cstrDescription, const lvInt ciSubSys_ID);
	static lvVoid Warning(const lvString &cstrDescription, const lvInt ciSubSys_ID);

	static lvVoid TraceMessage(const lvString &cstrMessage, const lvDword cdwColor = USE_DEFAULT_COLOR);

	static lvVoid OperationExecuted(const lvString &cstrOperationName, const lvString &cstrFilename, const lvInt ciLine = 0);
	static lvVoid OperationExit(const lvDword cdwStatus);
protected:
	virtual ~IErrorHandlingSys()
	{
	};

	virtual lvVoid _CriticalError(const lvString &cstrDescription, const lvInt ciSubSys_ID)=0;
	virtual lvVoid _Error(const lvString &cstrDescription, const lvInt ciSubSys_ID)=0;
	virtual lvVoid _Warning(const lvString &cstrDescription, const lvInt ciSubSys_ID)=0;
	
	virtual lvVoid _TraceMessage(const lvString &cstrMessage, const lvDword cdwColor)=0;

	virtual lvVoid _OperationExecuted(const lvString &cstrOperationName, const lvString &cstrFilename, const lvInt ciLine = 0)=0;
	virtual lvVoid _OperationExit(const lvDword cdwStatus)=0;

	static IErrorHandlingSys *m_pInstance;
};

#endif